package com.mes.cloud.dao;

import com.mes.cloud.api.dto.request.UpdateEnableRequest;
import com.mes.cloud.api.dto.request.organization.SynchroOrganizationFindSubByIdRequest;
import com.mes.cloud.api.dto.request.organization.SysOrganizationPageRequest;
import com.mes.cloud.api.dto.request.organization.SysOrganizationRequest;
import com.mes.cloud.api.dto.request.organization.SysOrganizationUpdateRequest;
import com.mes.cloud.entity.SysOrganization;
import com.mes.cloud.entity.vo.organization.SysOrganizationDetailsVo;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;

import java.util.List;

/**
 * 组织表
 *
 * @author xy
 * @version 2019-07-30 09:35:59
 * @email yuan.xue3@pactera.com
 */
public interface SysOrganizationDao extends SelectByIdsMapper<SysOrganization>, Mapper<SysOrganization> {

    /**
     * <分页查询>
     *
     * @param sysOrganizationPageRequest
     * @return List<SysOrganization>
     * @author xy
     * @date 2019/8/1 14:46
     */
    List<SysOrganization> selectPage(SysOrganizationPageRequest sysOrganizationPageRequest);

    /**
     * <通过员工ID查询授权组织>
     *
     * @param employeeId
     * @return List<SysOrganization>
     * @author xy
     * @date 2019/8/2 15:19
     */
    List<SysOrganization> selectAuthOrgByEmployeeId(String employeeId);

    /**
     * <根据组织ID查询组织详细信息>
     *
     * @param id
     * @return SysOrganizationDetailVo
     * @author xy
     * @date 2019/8/2 17:29
     */
    SysOrganizationDetailsVo getSysOrganizationDetail(String id);

    /**
     * <批量更新启用、禁用状态>
     *
     * @param updateEnableRequest
     * @return int
     * @author xy
     * @date 2019/8/6 9:14
     */
    int batchUpdateEnable(UpdateEnableRequest updateEnableRequest);

    /**
     * <根据id查询parentGroups 多个以,分隔>
     *
     * @param id
     * @return String
     * @author xy
     * @date 2019/8/14 11:12
     */
    String getParentGroupById(String id);

    /**
     * <查询组织的家族code,逗号相隔>
     *
     * @param id
     * @return String
     * @author xy
     * @date 2019/8/14 11:12
     */
    String getParentGroupCode(String id);

    /**
     * <查询所有有效数据>
     *
     * @param
     * @return List<SysOrganization>
     * @author xy
     * @date 2019/8/14 11:40
     */
    List<SysOrganization> listAll();

    /**
     * 更新code
     * @param sysOrganization
     * @return int
     */
    int updateByCode(SysOrganization sysOrganization);

    /**
     * <关联组织授权查询>
     * @author xy
     * @date   2019/8/29 10:45
     * @param  positionId
     * @return List<SysOrganization>
     */
    List<SysOrganization> listRelationPositionOrgAuth(String positionId);

    List<SysOrganization> findSubById(SynchroOrganizationFindSubByIdRequest synchroOrganizationFindSubByIdRequest);

    List<SysOrganization> selectChildrens(String parentId);

    List<SysOrganization> excludeQueryAuthOrganization(SysOrganizationUpdateRequest request);

    List<String> listChildren(List<String> orgAuthIds);

    SysOrganization  getOrgParent(SysOrganizationRequest sysOrganizationRequest);
}
